package com.wlb.test.service.rabbitmq.simple;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.wlb.test.util.rabbitmq.ConnectionUtil;
import com.wlb.test.util.rabbitmq.QueueEnum;

/**
 * @Author:wanglibing
 * @Mail:wanglibing@jd.com
 * @Date:Created in 21:22 2018/1/29
 * @Description:
 */
public class Send {
    public static void main(String[] args) throws Exception{
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();
        channel.queueDeclare(QueueEnum.QUEUE_NAME_SIMPLE.getName(),false,false,false,null);
//        消息内容
        String message = "Hello ABC";
        channel.basicPublish("",QueueEnum.QUEUE_NAME_SIMPLE.getName(),null,message.getBytes());
        System.out.println(" [X]  Send '" + message + "'");
        channel.close();
        connection.close();
    }
}
